﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy2_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            double f = Convert.ToDouble(textBox1.Text);
            double c = 5.0 / 9 * (f - 32); // 关键：5.0是double，避免整数除法
            textBox2.Text = c.ToString("F2"); // 保留2位小数
        
        }

        private void button2_Click(object sender, EventArgs e)
        {
            double c = Convert.ToDouble(textBox2.Text);
            double f = 9.0 / 5 * c + 32;
            textBox1.Text = f.ToString("F2");
        
    }
    }
}
